from urllib import request
import json


def get_content(url):
    with request.urlopen(url) as f:
        # 读取数据 格式为 文本字节
        data = f.read()
        # 解码数据 格式为 字典
        content = json.loads(data)
        return content['headers']['User-Agent']


print(get_content("http://httpbin.org/get"))
